package qz_rpt

class OnceCheckYieldController {

    def commonDataService
    def dynamicQueryService
    def index(Integer max) {
        def cellList = org.kdx.DataUtils.getCellList()
        def pageSizeList = org.kdx.DataUtils.getPageSizeList()

        [totalCount: 5, pageSize: 20, pageCurrent: 1, orderField: 'id', orderDirection: 'asc', pageSizeList: pageSizeList, cellList: cellList]
    }
    def onceCheckYield(){
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def pageSizeList = [10,20,50,100]
        params.SYS_QUERY_NAME = 'onceCheckYield'
        def onceCheckYield = dynamicQueryService.queryForList(params)
        def tableHeadList =  []
        if(onceCheckYield.size()>0){
            tableHeadList =  onceCheckYield[0].keySet()
        }
        params.SYS_QUERY_NAME = 'onceCheckYieldCount'
        def totalCount = dynamicQueryService.queryForList(params)[0].TOTALCOUNT

        /*params.SYS_QUERY_NAME = 'onceCheckYieldStepList'
        def onceCheckYieldStepList = dynamicQueryService.queryForList(params)*/
        params.SYS_QUERY_NAME = 'onceCheckYieldUserList'
        def onceCheckYieldUserList = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'onceCheckYieldPicNumList'
        def onceCheckYieldPicNumList = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'onceCheckYieldCateList'
        def onceCheckYieldCateList = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'onceCheckYieldStepList'
        def onceCheckYieldStepList = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'onceCheckYieldImg'
        def onceCheckYieldImg = dynamicQueryService.queryForList(params)
        [tableHeadList:tableHeadList,
         pageSizeList:pageSizeList,pageSize:pageSize,startTime:params.startTime?:'',endTime:params.endTime?:'',
         startno:params.startno?:'',endno:params.endno?:'',partPicNum:params.partPicNum?:'',
         partDesc:params.partDesc?:'',step:params.step?:'',onceCheckYield:onceCheckYield,totalCount:totalCount,
         /*onceCheckYieldStepList:onceCheckYieldStepList,*/onceCheckYieldUserList:onceCheckYieldUserList,
         onceCheckYieldPicNumList:onceCheckYieldPicNumList,onceCheckYieldCateList:onceCheckYieldCateList,
        stepName:params.stepName?:'',group4:params.group4?:'',group3:params.gourp3?:'',category:params.category?:'',
         onceCheckYieldStepList:onceCheckYieldStepList,step:params.step?:'',onceCheckYieldImg:onceCheckYieldImg]
    }
}
